<?php

class RegistrationView extends dmq\View
{
	public function buildRegistrationForm()
	{
		$this->markup( '<form action="index.php?c=registration" method="POST">' . "\r\n" );
		$this->markup( '  <fieldset>' . "\r\n" );
		$this->markup( '    <label for="registration-username">Username:</label>' . "\r\n" );
		$this->markup( '    <input type="text" name="registration-username" id="registration-username" />' . "\r\n" );
			
		$this->markup( '    <label for="registration-email">Email:</label>' . "\r\n" );
		$this->markup( '    <input type="text" name="registration-email" id="registration-email" />' . "\r\n" );
			
		$this->markup( '    <label for="registration-password">Password:</label>' . "\r\n" );
		$this->markup( '    <input type="password" name="registration-password" id="registration-password" />' . "\r\n" );
			
		$this->markup( '    <label for="registration-password-repeat">Password repeat:</label>' . "\r\n" );
		$this->markup( '    <input type="password" name="registration-password-repeat" id="registration-password-repeat" />' . "\r\n" );
			
		$this->markup( '    <input type="submit" name="registration-submit" id="registration-submit" value="Sign Up" />' . "\r\n" );
		
		$this->markup( '  </fieldset>' . "\r\n" );
		$this->markup( '</form>' . "\r\n" );
	}

    public function triedToRegister()
    {
        return isset( $_POST['registration-submit'] );
    }

	public function getUsername()
	{
		return isset( $_POST['registration-username'] ) ? $_POST['registration-username'] : NULL;
	}
	
	public function getPassword()
	{
		return isset( $_POST['registration-password'] ) ? $_POST['registration-password'] : NULL;
	}
	
	public function getPasswordRepeat()
	{
		return isset( $_POST['registration-password-repeat'] ) ? $_POST['registration-password-repeat'] : NULL;
	}
	
	public function getEmail()
	{
		return isset( $_POST['registration-email'] ) ? $_POST['registration-email'] : NULL;
	}
}
